package com.golxen.framework.db;


import com.golxen.framework.executor.GeneralTask;
import com.golxen.framework.user.dao.UserBussiness;
import com.golxen.framework.user.player.GamePlayerMgr;
import com.golxen.utils.LogUtil;

public class CheckSqlConnectionTask extends GeneralTask {

    @Override
    public void doRun() {
        try {
            boolean success = UserBussiness.checkSqlConnectionStatus();
            if (!success) {
                LogUtil.DB.error("sql connect exception");
                GamePlayerMgr.setDbConnect(false);
            }else {
                LogUtil.DB.info("sql connect is right");
                GamePlayerMgr.setDbConnect(true);
            }
        } catch (Exception ex) {
            LogUtil.DB.error("sql close connection exception");
            GamePlayerMgr.setDbConnect(false);
        }

    }
}
